<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>9.运算符-递增和递减运算符</title>
    <script>
        //1.前置递增运算符 ++ 写在变量的前面
        var age = 10;
        ++age;// 类似于age = age + 1 
        console.log(age);// 输出结果为 11
        // 2.口诀：先自加 后返回值
        var p = 10;
        console.log(++p + 10);//输出结果为 21
        console.log('--------------------------------------');
    </script>

    <script>
        // 1.后置递增运运算符
        var num = 10;
        num++;
        console.log(num);
        // 2.前置和后置单独使用时 效果是一样的
        // 3.后置自增的原则 口诀：先返回原值 后自加
        var day = 10;
        console.log(day++ + 10);
        console.log(day);
    </script>
</head>

<body>

</body>

</html>